//
//  SSBaseTableViewController.swift
//  MyMicroBlog
//
//  Created by stevenSu on 15/7/28.
//  Copyright © 2015年 stevenSu. All rights reserved.
//

import UIKit

class SSBaseTableViewController: UITableViewController {
    var userLogin = (SSUserToken.loadToken() != nil)
    var visitorView: SSVisitorView?
    
    override func viewDidLoad() {
        super.viewDidLoad()

    }
    
    override func loadView() {
        userLogin ? super.loadView() : setupVisitorView()
        
    }
    
    /// 设置访客视图
    private func setupVisitorView() {
        visitorView = SSVisitorView()
        view = visitorView
        visitorView?.delegate = self
        
    }

}

extension SSBaseTableViewController: SSVisitorViewDelegate {
    func visitorViewWillLogin() {
        let nav = UINavigationController(rootViewController: SSOAuthViewController())
        presentViewController(nav, animated: true, completion: nil)
    }
    
    func visitorViewWillRegister() {
        print("register")
    }
}
